import time

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait

path = 'msedgedriver.exe'
browser = webdriver.Edge(path)
browser.maximize_window()
# WebDriverWait(browser,10,1).until()
# browser.implicitly_wait(3)
browser.get('https://www.baidu.com')
time.sleep(3)
input = browser.find_element(By.ID,'kw')
input.send_keys('萌娘百科')
button = browser.find_element(By.ID, 'su')
button.click()
time.sleep(3)
guanwang= browser.find_element(By.XPATH, '//*[@id="searchTag"]/div/div/a[2]')
guanwang.click()
time.sleep(3)
link=browser.find_element(By.XPATH, '//*[@id="1"]/div/div[1]/div[1]/h3/a')
link.click()
time.sleep(3)
for i in range(10, 200):
    browser.execute_script("document.documentElement.scrollTop=10000")
    str = '//*[@id="page"]/div/a[10]'
    if i > 10:
        str = '//*[@id="page"]/div/a[11]'
    next = browser.find_element(By.XPATH, str)
    time.sleep(1)
    next.click()
    time.sleep(3)
